DSA Homework 1

Roger Jang


Due date: 20170313 23:59:59

Range Maximum Query

Problem definition

Given an array of $n$ integer $\{a_1, a_1, ..., a_n\}$ and a range of $[l, u]$, the range maximum query returns the maximum of $\{a_l, a_{l+1}, ..., a_u\}$. Usually the array is static (elements are fixed), and we need to perform the query $m$ times with different ranges.

There are several approaches to range maximum query, with different complexities in speed and storage, and preprocessing, as explained next. Your mission is to pick one of them for your implementation to meet the requirement of this assignment. (We will briefly review these methods in class.)

References:

I/O formats

Test cases

  1. n=5. m=3 ==> input, output
  2. n=100000. m=100000 ==> input, output

Requirements

Submission guidelines

To be announced soon.

Side notes